package com.example.activelifecycletest.persistence.db;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.activelifecycletest.R;

/**
 * 数据库主活动类
 * @author zhangding
 * @date 2022年04月25日15:44:12
 */
public class DatabaseMainActivity extends AppCompatActivity {
    private MyDatabaseHelper databaseHelper;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.avtivity_db_main);
        Button button = (Button) findViewById(R.id.create_database);
        databaseHelper = new MyDatabaseHelper(this,"BookStore.db",null,2);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                databaseHelper.getWritableDatabase();
            }
        });
    }
}
